﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Input;
using Squog_1._1.Managers;
using LevelEditor;

namespace Squog_1._1.Menu
{
    class MainWindow : MainMenuWindow
    {
        ButtonLayout Layout;

        public MainWindow()
            : base()
        {

        }

        public override void LoadContent(ContentManager Content)
        {
            base.LoadContent(Content);

            //Create the layout for the buttons
            Layout = new ButtonLayout(new Vector2(0, 0));

            //Initialize the buttons
            Layout.AddButtonToEnd("Single Player", MenuFont, true);
            Layout.AddButtonToEnd("Settings", MenuFont, true);
            Layout.SelectedDel += OnSelectHandeler;
        }

        private void OnSelectHandeler(object o, SelectedEventArgs e)
        {
            switch (e.SelectionNumber)
            {
                case 0:
                    //Start the game!!!
                    WindowManager.ChangeWindows(new LevelSelect());
                    break;
                case 1:
                    //Go to settings window
                    WindowManager.ChangeWindows(new SettingsWindow());
                    break;
            }
        }

        public override void Update(GameTime gameTime)
        {
            Layout.Update();

            base.Update(gameTime);
        }

        public override void Draw(GameTime gameTime)
        {
            base.Draw(gameTime);
            Layout.DrawButtons(WindowsSpriteBatch);
        }
    }
}

